package org.cash.factory;

import org.cash.cashrule.CashDiscount;
import org.cash.cashrule.CashNormal;
import org.cash.cashrule.CashReturn;
import org.cash.cashrule.CashSuper;

public class CashFactory {
    public static CashSuper createCashAdapter(String type) {
        switch (type) {
            case "NORMAL"://正常销售价
                return new CashNormal();
            case "DISCOUNT"://打折价
                return new CashDiscount(0.8d);
            case "RETURN"://满减价
                return new CashReturn(100d, 10d);
            default:
                throw new IllegalArgumentException("参数错误");
        }
    }
}
